package org.hackystat.devcathlon.ui.page.matches;

import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.hackystat.devcathlon.ui.DevcathlonSession;
import org.hackystat.devcathlon.ui.page.DevcathlonBasePage;

/**
 * Implements the top-level Matches page, which summarizes the Matches this user is participating
 * in.
 * 
 * @author John Zhou, John Ancheta
 */
public class MatchesPage extends DevcathlonBasePage {
  /** Support serialization. */
  private static final long serialVersionUID = 1L;

  /**
   * Creates the Match page. This page and its subpages contain information about this specific
   * user.
   */
  public MatchesPage() {
    // Set the body class attribute to section-1 so that the menubar is correct.
    add(new WebMarkupContainer("body") {
      private static final long serialVersionUID = 1L;

      @Override
      public boolean isTransparentResolver() {
        return true;
      }

      @Override
      protected void onComponentTag(ComponentTag tag) {
        tag.put("class", "thrColElsHdr section-3");
      }
    });

    // Make the tab corresponding to this page bold.
    get("MatchesLink").add(new SimpleAttributeModifier("class", "selected"));
    add(new MatchesPanel("MatchesPanel", DevcathlonSession.get().getMatchesSession()
        .getMatchNames()));
  }
}
